<?php

class EditDeleteFormScript extends ScriptBlock
{

	function __construct ()
	{
	$html =  "<script language = \"javascript\">\n";
	$html .= "function viewFile(ID, DBTableName)\n";
	$html .= "{\n";
	$html .= "document.getElementById(\"Action\").value = \"ViewFile\";\n";
	$html .= "document.getElementById(\"RecordID\").value = ID;\n";
	$html .= "document.getElementById(\"DBTableName\").value = DBTableName;\n";
	$html .= "document.getElementById(\"PageForm\").submit();\n";
	$html .= "}\n";
	$html .= "function viewRecord(ID, DBTableName)\n";
	$html .= "{\n";
	$html .= "document.getElementById(\"Action\").value = \"ViewRecord\";\n";
	$html .= "document.getElementById(\"RecordID\").value = ID;\n";
	$html .= "document.getElementById(\"DBTableName\").value = DBTableName;\n";
	$html .= "document.getElementById(\"PageForm\").submit();\n";
	$html .= "}\n";
	$html .= "function editRecord(ID, DBTableName)\n";
	$html .= "{\n";
	$html .= "document.getElementById(\"Action\").value = \"EditRecord\";\n";
	$html .= "document.getElementById(\"RecordID\").value = ID;\n";
	$html .= "document.getElementById(\"DBTableName\").value = DBTableName;\n";
	$html .= "document.getElementById(\"PageForm\").submit();\n";
	$html .= "}\n";
	$html .= "function deleteRecord(ID, DBTableName)\n";
	$html .= "{\n";
	$html .= "document.getElementById(\"Action\").value = \"DeleteRecord\";\n";
	$html .= "document.getElementById(\"RecordID\").value = ID;\n";
	$html .= "document.getElementById(\"DBTableName\").value = DBTableName;\n";
	$html .= "document.getElementById(\"PageForm\").submit();\n";
	$html .= "}\n";
	$html .= "function newRecord(DBTableName)\n";
	$html .= "{\n";
	$html .= "document.getElementById(\"Action\").value = \"NewRecord\";\n";
	$html .= "document.getElementById(\"RecordID\").value = \"\";\n";
	$html .= "document.getElementById(\"DBTableName\").value = DBTableName;\n";
	$html .= "document.getElementById(\"PageForm\").submit();\n";
	$html .= "}\n";
	$html .= "function newDatedRecord(DBTableName,Date)\n";
	$html .= "{\n";
	$html .= "document.getElementById(\"Action\").value = \"NewRecord\";\n";
	$html .= "document.getElementById(\"RecordID\").value = \"\";\n";
	$html .= "document.getElementById(\"NewRecordDate\").value = Date;\n";
	$html .= "document.getElementById(\"DBTableName\").value = DBTableName;\n";
	$html .= "document.getElementById(\"PageForm\").submit();\n";
	$html .= "}\n";
	$html .= "</script>\n";
	$this->scriptHTML = $html;
	}
}